<?php

namespace App\Exceptions;

use App\Helpers\ApiResponse;
use App\Http\Requests\Request;
use Exception;

class CouponCodeUnavailableException extends Exception
{
    use ApiResponse;

    public function __construct($message, int $code = 403)
    {
        parent::__construct($message, $code);
    }

    // 当这个异常被触发时，会调用 render 方法来输出给用户
    public function render()
    {
        return $this->failed($this->message);
    }
}
